package com.example.demo;

import lombok.Getter;

/**
 * Description: 特征模版数据类型
 *
 * @Author zhourunjin
 * @Date 2024/4/7 15:37
 */
@Getter
public enum TemplateDataType {
    String("String", String.class),
    Integer("Integer", Integer.class),
    Char("Character", Character.class),
    Double("Double", Double.class),
    Long("Long", Long.class),
    Float("Float", Float.class),
    Boolean("Boolean", Boolean.class);

    private final String code;
    private final Class clazz;

    TemplateDataType(java.lang.String code, Class clazz) {
        this.code = code;
        this.clazz = clazz;
    }

    public static TemplateDataType getFieldTypeByCode(String code) {
        for (TemplateDataType value : TemplateDataType.values()) {

            if (value.getCode().equals(code)) {
                return value;
            }
        }
        throw new RuntimeException("未定义的错误类型");
    }
}
